package org.jeecg.modules.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.system.entity.SysRole;

import java.util.List;

/**
 * @author : willian fu
 * @date : 2022/6/27
 */
public interface WflowRolesMapper extends BaseMapper<SysRole> {

    /**
     * 查询用户的所有角色信息
     * @param userId 用户ID
     * @return 用户拥有的角色列表
     */
    @Select("SELECT wr.* FROM sys_role sr, sys_user_role sur " +
            "WHERE sr.id = sur.role_id AND sur.user_id = ${userId}")
    List<SysRole> getRolesByUser(@Param("userId") Object userId);
}
